package paint;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;

public class StripedPaintContainer extends PaintContainer {
	private Color stripeColor = Color.RED;

	public StripedPaintContainer(Color outline, Rectangle bounds) {
		super(outline, null, bounds);
	}

	public StripedPaintContainer(Color outline, Color stripeColor, Rectangle bounds) {
		super(outline, null, bounds);

		this.stripeColor = stripeColor;
	}

	public StripedPaintContainer() {
		super();
	}

	@Override
	public void paint(Graphics g) {
		Paint paint = ((Graphics2D) g).getPaint();
		((Graphics2D) g).setPaint(new GradientPaint(0, 0, new Color(stripeColor.getRed(), stripeColor.getGreen(),
				stripeColor.getBlue(), 75), 1, 1, new Color(0, 0, 0, 200), true));
		g.fillRect(getX(), getY(), getWidth(), getHeight());

		((Graphics2D) g).setPaint(paint);
		g.setColor(outlineColor);
		g.drawRect(getX(), getY(), getWidth(), getHeight());

		for (PaintComponent component : components) {
			component.paint(g);
		}
	}
}
